// 练习一：Student 类
class Student {
    private String name;
    private String studentId;
    private String className;
    private String gender;
    private int age;
    private String personality;

    public Student(String name, String studentId, String className, String gender, int age, String personality) {
        this.name = name;
        this.studentId = studentId;
        this.className = className;
        this.gender = gender;
        this.age = age;
        this.personality = personality;
    }

    public String getName() {
        return name;
    }

    public String getStudentId() {
        return studentId;
    }

    public String getClassName() {
        return className;
    }

    public String getGender() {
        return gender;
    }

    public int getAge() {
        return age;
    }

    public String getPersonality() {
        return personality;
    }

    public String summary() {
        return "姓名: " + name + ", 学号: " + studentId + ", 班级: " + className + ", 性别: " + gender + ", 年龄: " + age + ", 性格: " + personality;
    }
}

// 练习二：Circle 类
class Circle {
    private double radius;

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public double area() {
        return Math.PI * radius * radius;
    }

    public double perimeter() {
        return 2 * Math.PI * radius;
    }
}

// 练习三：User 类
class User {
    private String account;
    private String password;
    private String email;

    public User(String account, String password, String email) {
        this.account = account;
        this.password = password;
        this.email = email;
    }

    public User(String account, String password) {
        this(account, password, "");
    }

    public void displayInfo() {
        System.out.println("账号: " + account + ", 密码: " + password + ", 邮箱: " + email);
    }
}

// 练习四：Draw 类
class Draw {
    private int height;

    public Draw(int height) {
        this.height = height;
    }

    public void drawTriangle() {
        for (int i = 1; i <= height; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public void drawRectangle() {
        for (int i = 1; i <= height; i++) {
            for (int j = 1; j <= height; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public void drawSquare() {
        drawRectangle();
    }

    public void drawParallelogram() {
        for (int i = 1; i <= height; i++) {
            for (int j = 1; j < i; j++) {
                System.out.print(" ");
            }
            for (int k = 1; k <= height; k++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}


public class Main {
    public static void main(String[] args) {
        // 练习一：Student 类测试
        Student s1 = new Student("张三", "2024001", "一班", "男", 20, "开朗");
        Student s2 = new Student("李四", "2024002", "二班", "女", 21, "内向");
        Student s3 = new Student("王五", "2024003", "三班", "男", 22, "活泼");
        System.out.println(s1.summary());
        System.out.println(s2.summary());
        System.out.println(s3.summary());

        // 练习二：Circle 类测试
        Circle c = new Circle();
        c.setRadius(5);
        System.out.println("半径为 " + c.getRadius() + " 的圆的面积: " + c.area());
        System.out.println("半径为 " + c.getRadius() + " 的圆的周长: " + c.perimeter());

        // 练习三：User 类测试
        User u1 = new User("user1", "pass1", "user1@example.com");
        User u2 = new User("user2", "pass2");
        u1.displayInfo();
        u2.displayInfo();

        // 练习四：Draw 类测试
        Draw d = new Draw(5);
        System.out.println("三角形:");
        d.drawTriangle();
        System.out.println("矩形:");
        d.drawRectangle();
        System.out.println("正方形:");
        d.drawSquare();
        System.out.println("平行四边形:");
        d.drawParallelogram();
    }
}